<template>
  <view class="about-container">
    <!-- 顶部栏 -->
    <view class="header">
      <view class="back-btn" @tap="goBack">
        <text class="back-icon">←</text>
      </view>
      <text class="header-title">关于我们</text>
      <view class="header-right"></view>
    </view>
    
    <!-- 应用信息 -->
    <view class="app-info">
      <image src="/static/wechat.png" class="app-logo"/>
      <text class="app-name">个人助手</text>
      <text class="app-version">版本 v1.0.0</text>
      <text class="app-description">一款集多功能于一体的个人管理工具</text>
    </view>
    
    <!-- 作者信息 -->
    <view class="author-info">
      <image src="/static/csdn-avatar.svg" class="author-avatar"/>
      <text class="author-name">CSDN作者 孜然卷K</text>
      <text class="author-stats">总访问量: 125,608 | 原创: 67篇</text>
    </view>
    
    <!-- 功能列表 -->
    <view class="features-section">
      <text class="section-title">核心功能</text>
      <view class="features-list">
        <view class="feature-item">
          <text class="feature-icon">📝</text>
          <text class="feature-text">备忘录管理</text>
        </view>
        <view class="feature-item">
          <text class="feature-icon">📅</text>
          <text class="feature-text">日历与日程</text>
        </view>
        <view class="feature-item">
          <text class="feature-icon">👥</text>
          <text class="feature-text">联系人管理</text>
        </view>
        <view class="feature-item">
          <text class="feature-icon">🔔</text>
          <text class="feature-text">智能提醒</text>
        </view>
      </view>
    </view>
    
    <!-- 链接列表 -->
    <view class="links-section">
      <view class="link-item" @tap="openServiceAgreement">
        <text class="link-text">服务协议</text>
        <text class="arrow-icon">→</text>
      </view>
      <view class="link-item" @tap="openPrivacyPolicy">
        <text class="link-text">隐私政策</text>
        <text class="arrow-icon">→</text>
      </view>
      <view class="link-item" @tap="checkForUpdates">
        <text class="link-text">检查更新</text>
        <text class="version-status">{{ updateStatus }}</text>
      </view>
    </view>
    
    <!-- 版权信息 -->
    <view class="copyright-section">
      <text class="copyright-text">© 2025 个人助手 版权所有</text>
      <text class="company-info">孜然卷个人小程序</text>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      updateStatus: '已是最新版本'
    };
  },
  methods: {
    // 返回上一页
    goBack() {
      uni.navigateBack();
    },
    
    // 打开服务协议
    openServiceAgreement() {
      uni.showModal({
        title: '服务协议',
        content: '感谢您使用个人助手应用！\n\n为了保障您的权益，请您仔细阅读并遵守我们的服务协议。\n\n点击确定前往完整协议页面。',
        confirmText: '确定',
        success: (res) => {
          if (res.confirm) {
            // 实际项目中应该跳转到协议详情页面
            this.showToast('打开服务协议');
          }
        }
      });
    },
    
    // 打开隐私政策
    openPrivacyPolicy() {
      uni.showModal({
        title: '隐私政策',
        content: '我们非常重视您的隐私保护！\n\n请您仔细阅读隐私政策，了解我们如何收集、使用和保护您的个人信息。\n\n点击确定前往完整隐私政策页面。',
        confirmText: '确定',
        success: (res) => {
          if (res.confirm) {
            // 实际项目中应该跳转到隐私政策详情页面
            this.showToast('打开隐私政策');
          }
        }
      });
    },
    
    // 检查更新
    checkForUpdates() {
      uni.showLoading({
        title: '检查中...'
      });
      
      // 模拟检查更新
      setTimeout(() => {
        uni.hideLoading();
        
        // 随机模拟是否有更新（80%概率已是最新版本）
        const hasUpdate = Math.random() < 0.2;
        
        if (hasUpdate) {
          this.updateStatus = '有新版本';
          uni.showModal({
            title: '发现新版本',
            content: '个人助手 v1.0.1 已发布，是否立即更新？\n\n更新内容：\n1. 修复已知问题\n2. 优化性能体验\n3. 新增部分功能',
            confirmText: '立即更新',
            cancelText: '稍后更新',
            success: (res) => {
              if (res.confirm) {
                // 实际项目中应该触发更新下载
                this.showToast('开始下载更新...');
              }
            }
          });
        } else {
          this.updateStatus = '已是最新版本';
          uni.showToast({
            title: '已是最新版本',
            icon: 'success'
          });
        }
      }, 1500);
    },
    
    // 显示提示
    showToast(message) {
      uni.showToast({
        title: message,
        icon: 'none'
      });
    }
  }
};
</script>

<style scoped>
.about-container {
  height: 100vh;
  background-color: #f8f9fc;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* 顶部栏 */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx 40rpx;
  background-color: #fff;
  box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.05);
}

.back-btn {
  padding: 10rpx;
}

.back-icon {
  font-size: 32rpx;
  color: #333;
}

.header-title {
  font-size: 36rpx;
  font-weight: 600;
  color: #333;
}

.header-right {
  width: 50rpx;
}

/* 应用信息 */
.app-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60rpx 0;
  background-color: #fff;
  margin-bottom: 20rpx;
}

/* 作者信息 */
.author-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40rpx 0;
  background-color: #fff;
  margin-bottom: 20rpx;
}

.author-avatar {
  width: 120rpx;
  height: 120rpx;
  border-radius: 50%;
  margin-bottom: 20rpx;
  border: 2rpx solid #eee;
}

.author-name {
  font-size: 36rpx;
  font-weight: 600;
  color: #333;
  margin-bottom: 10rpx;
}

.author-stats {
  font-size: 26rpx;
  color: #666;
}

.app-logo {
  width: 160rpx;
  height: 160rpx;
  border-radius: 30rpx;
  margin-bottom: 30rpx;
}

.app-name {
  font-size: 40rpx;
  font-weight: 600;
  color: #333;
  margin-bottom: 10rpx;
}

.app-version {
  font-size: 28rpx;
  color: #999;
  margin-bottom: 20rpx;
}

.app-description {
  font-size: 28rpx;
  color: #666;
  text-align: center;
  padding: 0 60rpx;
}

/* 功能列表 */
.features-section {
  background-color: #fff;
  margin-bottom: 20rpx;
  padding: 40rpx;
}

.section-title {
  font-size: 32rpx;
  font-weight: 600;
  color: #333;
  margin-bottom: 30rpx;
  display: block;
}

.features-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 30rpx;
}

.feature-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30rpx;
  background-color: #f8f9fc;
  border-radius: 20rpx;
}

.feature-icon {
  font-size: 48rpx;
  margin-bottom: 15rpx;
}

.feature-text {
  font-size: 28rpx;
  color: #666;
}

/* 链接列表 */
.links-section {
  background-color: #fff;
  margin-bottom: 20rpx;
}

.link-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 30rpx 40rpx;
  border-bottom: 1rpx solid #eee;
}

.link-item:last-child {
  border-bottom: none;
}

.link-text {
  font-size: 32rpx;
  color: #333;
}

.arrow-icon {
  font-size: 28rpx;
  color: #999;
}

.version-status {
  font-size: 28rpx;
  color: #667eea;
}

/* 版权信息 */
.copyright-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60rpx 0;
}

.copyright-text {
  font-size: 26rpx;
  color: #999;
  margin-bottom: 10rpx;
}

.company-info {
  font-size: 24rpx;
  color: #bbb;
}
</style>